<template>
	<view>
		<!-- <view class="tabBar_css"> -->
		<u-tabbar v-model="currentPagePath" :list="tabList" :mid-button="false"></u-tabbar>
		<!-- <u-tabbar :value="currentPagePath" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true">
				<u-tabbar-item v-for="(item,index) in tabBarList" :key="index" :text="item.text" :name="item.pagePath"
					@click="click_page(item)">
					<image class="u-page__item__slot-icon" slot="active-icon" :src="item.selectedIconPath"></image>
					<image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.iconPath"></image>
				</u-tabbar-item>
			</u-tabbar> -->
		<!-- </view> -->
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	export default {
		name: "tabBar",
		props: {
			currentPagePath: String,

		},
		data() {
			return {
				tabList: [],
			}
		},
		created() {
			if(uni.getStorageSync('isLoginBack')){
				uni.setStorageSync('isLoginBack',false)
				setTimeout(() => {
					// console.log('10', JSON.parse(uni.getStorageSync('tabBars')))
					this.tabList = JSON.parse(uni.getStorageSync('tabBars'))
					// console.log('12', this.tabList)
				}, 300)
			}else{
				// uni.removeStorageSync('isLoginBack')
				this.tabList = JSON.parse(uni.getStorageSync('tabBars'))
			}
		},
		computed: {
			// ...mapGetters([
			// 	'tabBarList',
			// ])
		},
		methods: {
			click_page(item) {
				// console.log(this.tabBarList,456);
				let page = '/' + item.pagePath
				uni.switchTab({
					url: page,
					success: function(res) {

					},
					fail: function(res) {

					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.tabBar_css {
		position: fixed;
		bottom: 0;
		z-index: 9999;
		width: 100%;

		.u-page__item__slot-icon {
			width: 48rpx;
			height: 48rpx;
		}
	}
</style>